<!doctype html>

<html>

<head>

<script>
var end = false;
//Create DB Connection

var handle = setInterval( work, 200);
function work(){
	if( end ){
		clearInterval(handle);
	}
	else{
		console.log(" working..." + Date.now());
	}
}

var db = openDatabase('mydb','1.0', 'JerryTestdb',1024);
console.log("database created successfully..." + Date.now());
//Create table under the above DB

db.transaction(function(query){

query.executeSql('create table if not exists user(id unique, usesr, passwd)');

});
console.log("table created successfully..." + Date.now());
//Insert values to the table

db.transaction(function(query){

query.executeSql("insert into user values (2,'Jerry','1234')");

});
console.log("entry inserted to table successfully..." + Date.now()); 
//Get stored values from the table

db.transaction(function(query){

query.executeSql('select * from user',[],function(u,results){

	document.write('length => ' + results.rows.length)

});

});
console.log("entry readed from DB successfully..." + Date.now());
end = true;
</script>

</head>

</html>